from random import randint
from graph import *
h = 200
w = 200
brushColor('yellow')
rectangle(0, 0, h, w)
line(w//2, 0, w//2, h)
line(h//2, w, h//2, 0)
brushColor('green')
x_a = -50
y_a = 50
x_b = 50
y_b = -50
x_a1 = x_a + w//2
x_b1 = x_b + w//2
y_a1 = -y_a + w//2
y_b1 = -y_b + w//2
rectangle(x_a1, y_a1, x_b1, y_b1)
n = int(input('Введите кол-во выстрелов:'))
penSize (1)
penColor('red')
brushColor('red')
k = 0
for i in range(n):
    x = randint(-w//2, w//2)
    y = randint(-h//2, h//2)
    x_e = x+w//2
    y_e = -y+h//2
    circle(x_e, y_e, 1)
    if x > x_a and x <= x_b and y <= y_a and y >= y_b:
         k += 1
         print('кол-во выстрелов:', n)
         print('кол-во выстрелов:', k)
run()
